<?php  
/*
SHOW GLOBAL VARIABLES LIKE 'wait_timeout';
SHOW GLOBAL VARIABLES LIKE 'interactive_timeout';
set global wait_timeout=30;
SET GLOBAL interactive_timeout=30;

*/
define('MAX_SLEEP_TIME',600);  
$hostname = "localhost";  
$username = "root";  
$password = "MhxzKhl#";  
$connect = mysql_connect($hostname, $username, $password);  
$result = mysql_query("SHOW FULL PROCESSLIST");
while ($row=mysql_fetch_array($result)) {
  $process_id=$row["Id"];
  if ($row["Time"] > 200 ) {
    $sql="KILL $process_id";
    mysql_query($sql);
  }
}
/*$result = mysql_query("SHOW PROCESSLIST",$connect);  
while ($proc = mysql_fetch_assoc($result)){  
    if($proc["Command"] == "Sleep" && $proc["Time"] > MAX_SLEEP_TIME){  
        echo $proc["Id"]."\n";  
        @mysql_query("KILL ".$proc["Id"],$connect);  
    }  
}*/
mysql_close($connect);

//shell 
/*
for i in {994..1145}; 
do mysql -uroot -p123456 -e "kill $i" ;
*/ 
?>  